home *** CD-ROM | disk | FTP | other *** search
- (*===========================================================================*)
- (* Mode change subroutine *)
- (* *)
- (* Copyright 1988, 1989, 1990, 1991 by H. Roy Engehausen. All rights *)
- (* reserved. *)
- (* *)
- (*===========================================================================*)
-
- {$UNDEF DEBUG_MC}
-
- PROCEDURE user_wants_sysop;
-
- LABEL no_exit,
- ok_exit;
-
- BEGIN;
-
- {$IFDEF DEBUG_MC}
- WRITELN('User wants sysop');
- {$ENDIF}
-
- (*-----------------------------------------------------------------------*)
- (* If this is the local console, things are ok *)
- (*-----------------------------------------------------------------------*)
-
- IF active_tcb^.tcb_console THEN
- GOTO ok_exit;
-
- {$IFDEF DEBUG_MC}
- WRITELN('Console test failed');
- {$ENDIF}
-
- (*-----------------------------------------------------------------------*)
- (* If this user cannot be a sysop, quit now *)
- (*-----------------------------------------------------------------------*)
-
- IF (active_tcb^.uid_data.user_flag AND user_f_sysop) = 0 THEN
- GOTO no_exit;
-
- (*-----------------------------------------------------------------------*)
- (* If remote sysops cannot use this port, quit now *)
- (*-----------------------------------------------------------------------*)
-
- IF NOT active_port^.port_r_sysop THEN
- GOTO no_exit;
-
- (*-----------------------------------------------------------------------*)
- (* If user authenicated already, then we are done *)
- (*-----------------------------------------------------------------------*)
-
- {$IFDEF DEBUG_MC}
- WRITELN('Password done already test');
- {$ENDIF}
-
- IF active_tcb^.tcb_sysop_pw_ok THEN
- GOTO ok_exit;
-
- (*-----------------------------------------------------------------------*)
- (* If this port and user don't require authentication, then we are done *)
- (*-----------------------------------------------------------------------*)
-
- {$IFDEF DEBUG_MC}
- WRITELN('Authenticate needed test');
- {$ENDIF}
-
- IF ((active_tcb^.uid_data.user_access.access_flags
- OR active_port^.dflt_access.access_flags)
- AND access_f_sysop) = 0 THEN
- GOTO ok_exit;
-
- (*-----------------------------------------------------------------------*)
- (* Authenticate! *)
- (*-----------------------------------------------------------------------*)
-
- {$IFDEF DEBUG_MC}
- WRITELN('Authenticate');
- {$ENDIF}
-
- user_auth(cmd_string);
-
- {$IFDEF DEBUG_MC}
- WRITELN('Authenticate result -- ', active_tcb^.error_sw);
- {$ENDIF}
-
- (*-----------------------------------------------------------------------*)
- (* Authentication worked. Go to routine *)
- (*-----------------------------------------------------------------------*)
-
- IF NOT active_tcb^.error_sw THEN
- GOTO ok_exit;
-
- (*-----------------------------------------------------------------------*)
- (* All authentication failures come here *)
- (*-----------------------------------------------------------------------*)
-
- no_exit:
-
- active_tcb^.error_sw := TRUE;
-
- EXIT;
-
- (*-----------------------------------------------------------------------*)
- (* All successes come here *)
- (*-----------------------------------------------------------------------*)
-
- ok_exit:
-
- active_tcb^.uid_data.user_class := user_c_rsu;
- active_tcb^.tcb_sysop_pw_ok := TRUE;
-
- END;
-
-
- PROCEDURE user_mode_change;
-
- BEGIN;
-
- IF word_count > 1 THEN
- BEGIN;
- send_message(message_err_wrd);
- active_tcb^.error_sw := TRUE;
- EXIT;
- END;
-
- IF LENGTH(cmd_word) > 2 THEN
- BEGIN;
- send_message(message_err_wrd);
- active_tcb^.error_sw := TRUE;
- EXIT;
- END;
-
- IF LENGTH(cmd_word) = 1 THEN
- cmd_word[2] := 'R';
-
- WITH active_tcb^, active_tcb^.uid_data DO
- CASE cmd_word[2] OF
- '?' : ;
- 'N' : user_class := user_c_nu;
- 'U' : user_class := user_c_uu;
- 'O' : user_class := user_c_ou;
- 'E' : user_class := user_c_eu;
- 'B' : user_class := user_c_bu;
-
- 'R' : user_wants_sysop; (* All flags set in this routine *)
-
- 'L' : BEGIN;
- IF tcb_console THEN
- user_class := user_c_lsu
- ELSE
- error_sw := TRUE;
- END;
-
- ELSE
- error_sw := TRUE;
-
- END;
-
- IF active_tcb^.error_sw THEN
- BEGIN;
- CASE active_tcb^.tcb_error_reason OF
- 0 : send_message(message_err_2nd);
- 1 : BEGIN;
- send_message(message_auth_incomplete);
- send_message(message_mode_switch);
- END;
- ELSE ;
- END;
- END
- ELSE
- send_message(message_mode_switch);
-
- END;